<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('牛奶出库列表')" />
</head>
<body class="gray-bg">
<div class="container-div" >
    <div class="row">
        <div id="printArea">


            <div>
                <div>
                    <form id="formId">
                        <!--  <div class="select-list">-->
                        <input hidden="hidden"  name="orderId" th:value="${orderId}"/>
                        <!--  </div>-->
                    </form>
                </div>

            </div>



            <div class="btn-group-sm" id="toolbar" role="group">
                <h3>出库单号：<span th:text="${order.orderCode}"></span>&nbsp;&nbsp;出库时间:&nbsp;&nbsp;<span data-format="yyyy-MM-dd HH:mm:ss"  th:text="*{#dates.format(order.createTime, 'yyyy-MM-dd HH:mm:ss')}"></span>&nbsp;&nbsp;出库经手人:&nbsp;&nbsp;<span th:text="${order.createBy}"></span>
                </h3>
            </div>
            <h3 align="center"> <span th:text="${order.orderCode}+牛奶出库单" id="ordercode" hidden="hidden"></span> </h3>

            <div class="col-sm-12 select-table table-striped">
<!--                <a class="btn btn-success btn-sm fl-r " href="javascript:void(0)" id="print-btn" orderType = "11">打印</a>-->
                <table id="bootstrap-table" data-mobile-responsive="true"></table>
                <h3> <span class="fl-l" id="autograph" hidden="hidden"></span> </h3>
            </div>
            <div class="btn-group-sm" id="toolbar1" role="group">

                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-warning" id="print-btn" orderType = "11">
                    <i class="fa fa-download"></i> 打印
                </a>
            </div>

        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncInputChicken:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncInputChicken:remove')}]];
    var prefix = ctx + "system/ncOutputMilk";
    var datas = [[${@dict.getType('outputType')}]];

    $(function() {
        var options = {
            url: prefix + "/list?orderId="+[[${orderId}]],
            createUrl: prefix + "/add",
            updateUrl: ctx+'system/ncOutputMilk'+ "/edit/{id}",
            removeUrl: ctx+'system/ncOutputMilk' + "/remove",
            exportUrl: prefix + "/export",
            modalName: "牛奶入库",
            showExport: false,
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            toolbar: 'toolbar1',
            sortName:'outputTime',
            sortOrder:'desc',
            columns: [
                /*{
                checkbox: false
                },*/
                /*{
                    field : 'outputId',
                    title : '序号',
                },*/
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                /*{
                    field : 'inputId',
                    title : '批次',
                    sortable: true
                },*/
                /*{
                    field : 'cforderId',
                    title : '菜房订单id',
                    sortable: true
                },*/
                {
                    field : 'cforderCode',
                    title : '牛奶批次',
                },
                {
                    field : 'cropNameCn',
                    title : '产品名称',
                },{
                    field : 'outputType',
                    title : '出库类型',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                /*{
                    field : 'cropVarietiesCn',
                    title : '产品种类',
                },*/
                {
                    field : 'requestAmount',
                    title : '需求数量（kg）',
                    sortable: true
                },
                {
                    field : 'outputAmout',
                    title : '实际提供数量（kg）',
                    sortable: true
                },
                /*{
                    field : 'bottleAmount',
                    title : '瓶数',
                    sortable: true
                },*/
                {
                    field : 'outputTime',
                    title : '出库时间',
                    sortable: true
                },
                {
                    field : 'outputUser',
                    title : '出库经手人',
                    sortable: true
                },
                /*{
                    field : 'createBy',
                    title : '创建者',
                    sortable: true
                },
                {
                    field : 'createTime',
                    title : '创建时间',
                    sortable: true
                },*/
                {
                    field : 'remark',
                    title : '备注',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.outputId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="$.operate.remove(\'' + row.outputId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    /*表单确认*/
    function confirmTable() {
        var confirmTable = prefix + "/confirmTable";
        var data = $('#bootstrap-table').bootstrapTable('getData');
        if (data && data.length > 0) {

            $.modal.confirm("确认生成订单吗？", function () {
                var ids = [];
                $(data).each(function (i, e) {
                    ids.push(e.inputId);
                });
                var ids_str = ids.join(",");
                myPost(confirmTable, {ids: ids_str},
                    function (data) {

                        if (data.code == 0) {
                            layer.msg("提交成功")
                        } else {
                            layer.msg(data.msg);
                        }
                        reload()
                    }, function (e) {
                        layer.msg("确认失败!");
                        reload()
                    })

            })
        } else {
            layer.msg("未发现数据!")
        }

    }
    /*打开检测记录单*/
    function openOrder() {

        var url = ctx + 'system/ncOrder?orderType=12 ';

        $.modal.openTab("检测记录单", url);
    }
    function reload() {
        $.table.refresh();
    }

    function test_print() {
       window.location.href= ctx + 'system/ncOutputMilk/print'

    }
</script>
</body>
</html>